package com.heima.e_commerce;

import java.util.ArrayList;

public class CashPayment extends Payment{
    private ArrayList<Product> list;

    public CashPayment(ArrayList<Product> list) {
        this.list = list;
    }

    @Override
    public void pay() {
        double allprice = 0;
        for (int i = 0; i < list.size(); i++) {
            Product p1 = list.get(i);
            allprice += p1.getPrice();
        }
        System.out.println("支付方式为现金支付,支付金额为" + allprice);

    }
}
